/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.DriverChoseLevelFreightMapper;
import com.ybkj.daijia.server.model.DriverChoseLevelFreight;
import com.ybkj.daijia.server.service.DriverChoseLevelFreightService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 *
 */
@Service
public class DefaultDriverChoseLevelFreightService implements DriverChoseLevelFreightService {

    @Autowired
    private DriverChoseLevelFreightMapper driverChoseLevelFreightMapper;

    @Transactional(rollbackFor = Exception.class)
    public DriverChoseLevelFreight insertRecord(DriverChoseLevelFreight driverChoseLevelFreight) {

        driverChoseLevelFreightMapper.insertRecord(driverChoseLevelFreight);

        return driverChoseLevelFreight;

    }

    @Transactional(rollbackFor = Exception.class)
    public DriverChoseLevelFreight updateByPrimaryKey(
        DriverChoseLevelFreight driverChoseLevelFreight) {

        driverChoseLevelFreightMapper.updateByPrimaryKey(driverChoseLevelFreight);

        return driverChoseLevelFreight;
    }

    @Override
    public DriverChoseLevelFreight findByDriverAndLevelAndCompany(Long driverId, Long driverLevelId,
        Long companyId) {

        return driverChoseLevelFreightMapper.selectByPrimaryKey(driverId, driverLevelId, companyId);
    }

    @Override
    public DriverChoseLevelFreight findByDriverAndCompany(Long driverId, Long companyId) {

        return driverChoseLevelFreightMapper.selectByDriverAndCompany(driverId, companyId);
    }

    @Transactional(rollbackFor = Exception.class)
    public void delete(Long driverId, Long driverLevelId) {
        driverChoseLevelFreightMapper.deleteByDriverAndDriverLevel(driverId, driverLevelId);
    }


    @Transactional(rollbackFor = Exception.class)
    public void deleteByDriver(Long driverId) {

        driverChoseLevelFreightMapper.deleteByDriver(driverId);

    }


    @Transactional(rollbackFor = Exception.class)
    public void deleteByDriverLevel(Long driverLevelId) {

        driverChoseLevelFreightMapper.deleteByDriverLevel(driverLevelId);

    }

    @Override
    public DriverChoseLevelFreight findOne(Long id) {

        return null;
    }


}